#include <stdio.h>

typedef unsigned char uchar;
typedef unsigned int uint;

#define BYTES 100
#define SIZE (BYTES * sizeof(uint))

uchar display[BYTES];

int main ()
{
	uint test_cases, t, p;
	int c;

	scanf( "%u ", &test_cases );
	for( t = 1; t <= test_cases; ++t )
	{
		for( p = 0; p < BYTES; ++p )
			display[p] = 0;
		p = 0;
		while( c = getchar(), c != '\n' && c != EOF )
		{
			switch( c )
			{
				case '>':
					++p; p %= BYTES;
					break;
				case '<':
					p += BYTES - 1; p %= BYTES;
					break;
				case '+':
					++display[p];
					break;
				case '-':
					--display[p];
					break;
			}
		}
		printf( "Case %u:", t);
		for( p = 0; p < BYTES; ++p )
			printf(" %02X", display[p]);
		putchar( '\n' );
	}

	return 0;
}